Tutorial: Create an app to provision 3rd-party devices

In this tutorial you will learn how receive the data from the Users and Devices App Services when provisioning a 3rd-party phone. This data must be managed somehow and sent to your phone.

Conventions

Your filenames might be different according to your settings. You need to select your app con the Apps tab from the Profile App Object on the PBX. Otherwise the Profile App will not be able to send the data to your app.

Testing and expected behaviour

For testing you need to start a phone provisioning on the Profile App.

Step by step

Task 1: Publish de app as a provisioning provider

On the session class, you need to publish your app as a provider to provision phones using the AppWebsocketServiceInfo function.

Task 2: Receive the data from the Profile App

The data will be received inside the AppWebsocketMessage function on the session class with the mt "ProvisioningPhone".

Parameters received with ProvisioningPhone

string macThe MAC address from the 3rd-party phone.
string codeThe provisioning code provided by Devices. With that code Devices knows which config will be provided for that phone depending on the category selected.
string hwidThe Hardware ID set by Profile on the User Object on the PBX.
string usenameThe username of the user for which the phone is being provisioned.
string cnThe common name of the user for which the phone is being provisioned.
string seed1The seed to decrypt the password on the app side.
string passwordThe user's password encrypted'. AppWebsocketDecrypt can be used to get the decrypted password.
string domainThe PBX domain.
string dnsThe PBX DNS.
{"mt":"ProvisioningPhone","mac":"112233445566","code":"562822784750","hwid":"112233445566","usename":"test_user","cn":"Test User","seed1":"10046478319880090512700","password":"ddfc00","domain":"test.com","dns":"172.16.0.255"}

If the Users Admin App is used to provision several phones instead of the Profile App, the workflow is the next one:

Users App Service already creates a device on the User PBX Object with a basic configuration. If any other configuration is needed for the provisioning, this must be managed by your app. By default Hardware ID, Name and App are filled with the information provided on Profile or Users Admin App and TLS only and Reverse Proxy flags are selected.

Task 3: Get the published services to be able to connect with Devices later

To set the Sysclient connection to get the phone configuration from Devices later.

Task 4: Get the phone configuration with the Sysclient connection

After the configuration received from the Profile App has been stored on the DB, the sysclient connection must be set with Devices to be able to receive the phone configuration and its updates. To learn more about this protocol you can check this article.

Useful documentation